package cn.dengta.webapp.user.model;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.common.model.ValueProxyImpl;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

/**
 * 联系方式
 */
@Getter
public enum ContactType implements ValueProxyImpl<ContactType, Integer> {
	/** WhatsApp */
	WHATS_APP(0, "WhatsApp"),
	/** Telegram */
	TELEGRAM(1, "Telegram"),
	/** Email */
	MAIL(2, "Email"),
	//
	;

	// 定义私有变量
	@EnumValue
	public final Integer value;
	final ValueProxy<ContactType, Integer> proxy;

	// 构造函数，枚举类型只能为私有
	ContactType(Integer value, String label) {
		this.value = value;
		this.proxy = new ValueProxy<>(this, value, label);
	}

	public static ContactType[] getValues() {
		return ValueProxy.getCachedArray(ContactType.class, ContactType::values);
	}

	public static ContactType of(Integer value) {
		return WHATS_APP.getValueOf(value);
	}

}
